Skip to content

How to load a remote extension in geckoview? #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
baseplate-admin opened this issue May 18, 2024 · 4 comments
Open

How to load a remote extension in geckoview? #240

baseplate-admin opened this issue May 18, 2024 · 4 comments

Comments

@baseplate-admin
Copy link

baseplate-admin commented May 18, 2024

Hi, i have this following kotlin code

  sRuntime.getWebExtensionController().ensureBuiltIn(
            EXTENSION_LOCATION,
            "uBlock0@raymondhill.net"
        ).accept(
            { extension ->
                // Use Log to print information about the installed extension
                Log.i("MessageDelegate", "Extension installed: " + extension)
            },
            { e ->
                // Handle error if registering the WebExtension fails
                Log.e("MessageDelegate", "Error registering WebExtension", e)
            }
        )

and this location.

But this doesn't register and the log has some weird things in it:

E/GeckoConsole( 5168): _g
I/GeckoConsole( 5168): 1716030203919    addons.webextension.uBlock0@raymondhill.net     WARN    Loading extension 'uBlock0@raymondhill.net': Reading manifest: Warning processing permissions: Error processing permissions.2: Value "menus" must either: must either [must either [must either [be one of ["idle"], be one of ["activeTab"], be one of ["cookies"], be one of ["scripting"], or be one of ["webRequest", "webRequestAuthProvider", "webRequestBlocking", "webRequestFilterResponse", "webRequestFilterResponse.serviceWorkerScript"]], must either [be one of ["mozillaAddons"], be one of ["geckoViewAddons", "nativeMessagingFromContent"], be one of ["activityLog"], be one of ["networkStatus"], or be one of ["telemetry"]], be one of ["alarms", "storage", "unlimitedStorage"], be one of ["contextualIdentities"], be one of ["declarativeNetRequestWithHostAccess"], be one of ["dns"], or be one of ["theme"]], must either [must either [be one of ["idle"], be one of ["activeTab"], be one of ["cookies"], be one of ["scripting"], or be one of ["webRequest", "
I/GeckoConsole( 5168): 1716030203920    addons.webextension.uBlock0@raymondhill.net     WARN    Loading extension 'uBlock0@raymondhill.net': Reading manifest: Warning processing commands: An unexpected property was found in the WebExtension manifest.
E/MessageDelegate( 5168): Error registering WebExtension
E/MessageDelegate( 5168): java.lang.Exception: Unexpected error: Error: Extension is invalid
E/MessageDelegate( 5168):       at org.mozilla.geckoview.WebExtensionController$$ExternalSyntheticLambda15.onException(Unknown Source:0)
E/MessageDelegate( 5168):       at org.mozilla.geckoview.GeckoResult.lambda$map$1(GeckoResult.java:419)
E/MessageDelegate( 5168):       at org.mozilla.geckoview.GeckoResult$$ExternalSyntheticLambda9.onException(Unknown Source:2)
E/MessageDelegate( 5168):       at org.mozilla.geckoview.GeckoResult.lambda$thenInternal$6(GeckoResult.java:593)
E/MessageDelegate( 5168):       at org.mozilla.geckoview.GeckoResult.$r8$lambda$nsAzyhhKgAo0Ha3SEAUSdsKADo8(Unknown Source:0)
E/MessageDelegate( 5168):       at org.mozilla.geckoview.GeckoResult$$ExternalSyntheticLambda5.run(Unknown Source:8)
E/MessageDelegate( 5168):       at org.mozilla.geckoview.GeckoResult.lambda$dispatchLocked$7(GeckoResult.java:792)
E/MessageDelegate( 5168):       at org.mozilla.geckoview.GeckoResult$$ExternalSyntheticLambda1.run(Unknown Source:2)
E/MessageDelegate( 5168):       at android.os.Handler.handleCallback(Handler.java:958)
E/MessageDelegate( 5168):       at android.os.Handler.dispatchMessage(Handler.java:99)
E/MessageDelegate( 5168):       at android.os.Looper.loopOnce(Looper.java:205)
E/MessageDelegate( 5168):       at android.os.Looper.loop(Looper.java:294)
E/MessageDelegate( 5168):       at android.app.ActivityThread.main(ActivityThread.java:8177)
E/MessageDelegate( 5168):       at java.lang.reflect.Method.invoke(Native Method)
E/MessageDelegate( 5168):       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
E/MessageDelegate( 5168):       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:97

Is there any way i can load extensions such as ublock Origin into my android GeckoView?

thanks a lot in advance

@decryptable
Copy link

Have you found a solution yet? I'm also having the same problem. I tried several solutions and suggestions from different forums, but I haven't been able to resolve it.

@baseplate-admin
Copy link
Author

Have you found a solution yet? I'm also having the same problem. I tried several solutions and suggestions from different forums, but I haven't been able to resolve it.

Yep,

Please check out this code, and it has to have this folder too

@decryptable
Copy link

From what I've seen, it looks like it's the same as my project in how it's done. What exactly is the main problem?

@baseplate-admin
Copy link
Author

Does your app include ublock orgin folder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants